import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/login',
      name: 'login',
      // which is lazy-loaded when the route is visited.
      // 按需加载：注释的作用是将这个login组件最后打包成一个以注释名字作为文件名的js文件
      component: () => import(/* webpackChunkName: "login" */ '../views/login.vue')
    },
    {
      path: '/',
      name: 'home',
      redirect: '/welcome',
      component: () => import(/* webpackChunkName: "home" */ '../views/home.vue'),
      children: [
        {
          path: 'welcome',
          name: 'welcome',
          component: () => import(/* webpackChunkName: "welcome" */ '../views/welcome.vue')
        },
        {
          path: 'users',
          name: 'users',
          component: () => import(/* webpackChunkName: "users" */ '../views/users.vue')
        },
        {
          path: 'roles',
          name: 'roles',
          // which is lazy-loaded when the route is visited.
          // 按需加载：注释的作用是将这个login组件最后打包成一个以注释名字作为文件名的js文件
          component: () => import(/* webpackChunkName: "roles" */ '../views/auth/roles.vue')
        },
        {
          path: 'rights',
          name: 'rights',
          // which is lazy-loaded when the route is visited.
          // 按需加载：注释的作用是将这个login组件最后打包成一个以注释名字作为文件名的js文件
          component: () => import(/* webpackChunkName: "rights" */ '../views/auth/rights.vue')
        },
        {
          path: 'categories',
          name: 'categories',
          // which is lazy-loaded when the route is visited.
          // 按需加载：注释的作用是将这个login组件最后打包成一个以注释名字作为文件名的js文件
          component: () => import(/* webpackChunkName: "categories" */ '../views/cate/categories.vue')
        },
        {
          path: 'goods',
          name: 'goods',
          // which is lazy-loaded when the route is visited.
          // 按需加载：注释的作用是将这个login组件最后打包成一个以注释名字作为文件名的js文件
          component: () => import(/* webpackChunkName: "goods" */ '../views/cate/goods.vue')
        },
        {
          path: 'add',
          name: 'add',
          // which is lazy-loaded when the route is visited.
          // 按需加载：注释的作用是将这个login组件最后打包成一个以注释名字作为文件名的js文件
          component: () => import(/* webpackChunkName: "addGoods" */ '../views/cate/addGoods.vue')
        }
      ]
    }
  ]
})
